package main;

import java.io.File;

import com.google.common.base.Preconditions;

public class UniqueFileCreator {
  private final String from;

  public UniqueFileCreator(String from) {
    this.from = Preconditions.checkNotNull(from);
  }

  public File uniqFile() {
    return reqUniqFile(from);
  }

  private File reqUniqFile(String from) {
    File file = new File(from);
    if (!file.exists()) {
      return file;
    } else {
      return reqUniqFile("_" + from);
    }
  }

}
